#include "BaseType.h"
#include "Tracer.h"

using namespace libemb;

class Earth{
DECL_CLASSNAME(Earth)
public:
    static Earth& getInstance()
    {
        static Earth instance;
        return instance;
    }
    virtual ~Earth(){};
    void sayHello()
    {
        TRACE_DBG_CLASS("I am Earth, my address:0x%08x",this);
    }
private:
    //构造函数私有化
    Earth(){};
    //删除拷贝构造函数
    Earth(const Earth& copy) = delete;
    //删除赋值运算符
    Earth& operator=(const Earth&) = delete;
};

int main()
{
    Tracer::getInstance().setLevel(TRACE_LEVEL_DBG);
	Tracer::getInstance().addSink(std::make_shared<STDSink>()).start();

    auto& planetA = Earth::getInstance();
    planetA.sayHello();

    auto& planetB = Earth::getInstance();
    planetB.sayHello();

    return RC_OK;
}